<%@page import="isquirrel.beans.User"%>
<%@page import="isquirrel.util.HibernateUtil"%>
<%@page import="java.util.List" %>
<%@page import="isquirrel.UserManager"%>
<%@page import="isquirrel.beans.Url"%>
<%@page import="java.net.URLDecoder" %>


<div style="font-weight: bold; color: rgb(114, 114, 114);margin-bottom:12px">Pages you've liked</div>
<%
	HibernateUtil.beginTransaction();
	User u = UserManager.getUser((String)session.getAttribute("user")); 
	List<Url> likedUrls = u.getLikedUrls();
	if (likedUrls.size() < 1){
			String r = request.getRequestURI().split("/")[1];
			out.print("<p style='font-size:1em; color: #bbb'>You haven't liked any pages so far.<br><br> <a style='font-weight:bold;font-size:1.4em;color:white;text-decoration:none; padding:3px; background-color:#A5C97F' href='/" +  r + "/servlet/Profiler?nextp=home'>View recommendations</a></p>");
	}
	else{
		for (Url url : likedUrls) { %>
			<div class="likecontainer" style="background-image: url(/iSquirrel/images/<%out.print(url.getThumb());%>)">
				<a class='like' target='_blank' href='<%out.print(url.getAddress()); %>'><% out.print(URLDecoder.decode(url.getTitle(), "UTF-8")); %></a>
			</div>
<%		}
	}
	HibernateUtil.commit();
%>
		



